package com.craterhill.java.ccp.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.craterhill.java.ccp.common.beans.Country;
import com.craterhill.java.ccp.dao.impl.AbstractDao;
import com.craterhill.java.ccp.dao.utils.CCPResultSetExtractor;

public interface CountryDao extends CCPDao<Country> {
	public final String FIELD_LIST = "obj.country_Id, obj.country" + AbstractDao.MONITER_FIELDS;
	public final String FIND_ALL_COUNTRY = " select " + FIELD_LIST + " from country obj ";

	public final class CountryExtractor extends CCPResultSetExtractor<Country> {
		@Override
		protected Country extractResultSetData(ResultSet resultSet) throws SQLException {
			Country country = new Country();
			country.setCountryId(resultSet.getInt(1));
			country.setCountry(resultSet.getString(2));
			country.setStatus(resultSet.getBoolean(3));
			country.setCreatedBy(resultSet.getInt(4));
			country.setModifiedBy(resultSet.getInt(5));
			country.setCreatedDate(resultSet.getDate(6));
			country.setModifiedDate(resultSet.getDate(7));
			return country;

		}

	}

}
